package com.zhu.servlet;

import com.zhu.dao.ClassDao;
import com.zhu.pojo.Classes;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public class ClassesServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        List<Classes> classesList=null;
        try {
            classesList = new ClassDao().getClasses();
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        req.setAttribute("classesList",classesList);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
